﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;
using ObjectModel.PowerPoint.New;

namespace ViewComponents.Converters
{
    public class SourceObjectTypeToTextConverter : IValueConverter
    {
        const string CONSTANT_TYPE_TEXT = "Constant";
        const string EXCEL_RANGE_TYPE_TEXT = "Excel Range";

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return string.Empty;
            
            switch ((SourceObjectType)value)
            {
                case SourceObjectType.Constant:
                    return CONSTANT_TYPE_TEXT;

                case SourceObjectType.ExcelRange:
                    return EXCEL_RANGE_TYPE_TEXT;

                default:
                    throw new InvalidOperationException("Source object type is not valid.");
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }
    }
}
